<template>
  <div class="components-container">
    <sweet-modal ref="dialogdetail" class="dialog" :sweetModalMaxWidth="pageWidth">
      <h3>{{title}}</h3>
      <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
        <el-tab-pane label="基本信息" name="first">
          <div :style="{maxHeight:maxHeight+'px'}" style="overflow:auto;">
            <fieldset class="layui-elem-field layui-field-title">
              <legend style="font-weight: bold;">死者基本信息111</legend>
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label">逝者类型</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMTYPES" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">填报单位</label>
                  <div class="layui-input-inline">
                    <el-input
                      :autosize="{ minRows: 2, maxRows: 8}"
                      placeholder="请输入单位"
                      v-model="jpmData.JPMREPORTUNITDESC"
                      readonly
                    ></el-input>
                  </div>
                </div>
                <div class="layui-inline" v-if="IsHaveAcceptancePlatform">
                  <label class="layui-form-label">预约编号</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.DECNO" style="width: 160px;" readonly></el-input>
                  </div>
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label">逝者姓名</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMNAME" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">逝者性别</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMSEXS" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">逝者年龄</label>
                  <div class="layui-input-inline">
                    <el-input style="width:160px;" v-model="jpmData.JPMAGE" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">证件类型</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMCARDTYPE" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline" style="width:575px;margin-right:0px;">
                  <label class="layui-form-label">证件号码</label>
                  <div class="layui-input-inline">
                    <el-input
                      class="longertext"
                      :autosize="{ minRows: 2, maxRows: 8}"
                      placeholder="请输入证件号码"
                      v-model="jpmData.JPMCARDNO"
                      readonly
                    ></el-input>
                  </div>
                </div>
              </div>

              <div class="layui-inline-item">
                <div class="layui-inline" style="width:900px;margin-right:0px;">
                  <label class="layui-form-label">户籍地址</label>
                  <div class="layui-input-inline">
                    <el-input
                      class="longertexts"
                      :autosize="{ minRows: 2, maxRows: 8}"
                      placeholder="请输入户籍地址"
                      v-model="jpmData.JPMDETAILADDRESS"
                      readonly
                    ></el-input>
                  </div>
                </div>
              </div>

              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label">死亡原因</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMCAUSAS" readonly></el-input>
                  </div>
                  <div class="layui-input-inline" style="width: 294px;">
                    <el-input v-model="jpmData.JPMCAUSEOTHER" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">死亡地点</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMDEATHADDRESS"  style="width:160px;" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">死亡日期</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMDEATHDATE" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">出生日期</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMBIRTHDATE" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline"  v-if="showmodel">
                <label class="layui-form-label">预约日期</label>
                <div class="layui-input-inline">
                  <el-input style="width:160px" v-model="jpmData.TSKDATEDESC" readonly></el-input>
                </div>
                </div>
              </div>
              <div class="layui-form-item" v-if="showtimeduan">
                <div class="layui-inline">
                    <label class="layui-form-label">时间段</label>
                    <div class="layui-input-inline">
                    <el-input v-model="jpmData.Period" readonly></el-input>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label" >已预约数量</label>
                    <div class="layui-input-inline">
                        <el-input type="text" v-model="carTimenex.TSKHASCOUNT"  style="width:190px" readonly></el-input>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label" style="width:122px">最多可预约数量</label>
                    <div class="layui-input-inline" style="width:129px">
                        <el-input type="text" v-model="carTimenex.TSPNUBER"  readonly></el-input>
                    </div>
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label">家属姓名</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMLINKMAN" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline" v-if="isshow">
                  <label class="layui-form-label">待办地址</label>
                  <div class="layui-input-inline" style="width:500px">
                    <el-cascader
                      style="width:466px"
                      v-model="arr"
                      :options="addressOptions"
                      readonly
                    ></el-cascader>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">证件类型</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMLINKLERCARDTYPE" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline" style="width:575px;margin-right:0px;">
                  <label class="layui-form-label">证件号码</label>
                  <div class="layui-input-inline">
                    <el-input
                      class="longertext"
                      :autosize="{ minRows: 2, maxRows: 8}"
                      v-model="jpmData.JPMLINKLERCARDNO"
                      readonly
                    ></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">逝者关系</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMLINKRELATION" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">联系电话</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMLINKPHONE" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline" v-if="this.OrganOptions.length > 1">
                  <label class="layui-form-label">所属殡仪馆</label>
                  <div class="layui-input-inline">
                    <el-select v-model="jpmData.JPMPVDNO" style="width:160px" disabled>
                      <el-option
                        v-for="item in OrganOptions"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      ></el-option>
                    </el-select>
                  </div>
                </div>
              </div>

              <div class="layui-form-item">
                <div class="layui-inline" style="width:900px;margin-right:0px;">
                  <label class="layui-form-label">联系地址</label>
                  <div class="layui-input-inline">
                    <el-input
                      class="longertexts"
                      :autosize="{ minRows: 2, maxRows: 8}"
                      placeholder="请输入联系地址"
                      v-model="jpmData.JPMLINKLERHOUSEHOLD"
                      readonly
                    ></el-input>
                  </div>
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label">五保/低保</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMLOWTYPE" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">参保月数</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMSOCIALYEAR" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline" style="width:290px;">
                  <label class="layui-form-labels">是否残疾：</label>
                  <el-radio-group v-model="jpmData.JPMISDEFORMITY" style="margin-top:7px;">
                    <el-radio disabled label="B">是</el-radio>
                    <el-radio disabled label="A">否</el-radio>
                  </el-radio-group>
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-inline" style="width:900px;margin-right:0px;">
                  <label class="layui-form-label">备注</label>
                  <div class="layui-input-inline backcolor">
                    <el-input
                      class="longertexts"
                      :autosize="{ minRows: 2, maxRows: 8}"
                      placeholder="请输入备注"
                      v-model="jpmData.JPMADUITREMARK"
                      :readonly="isshowbeizhu"
                    ></el-input>
                  </div>
                </div>
              </div>
            </fieldset>
            <fieldset class="layui-elem-field layui-field-title">
              <legend style="font-weight: bold;">火化信息反馈</legend>
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label" style="width:90px;">火化日期</label>
                  <div class="layui-input-inline">
                    <!-- JPMCREMATIONDATE -->
                    <el-input v-model="jpmData.JPMCREMATIONDATEDESC" readonly></el-input>
                  </div>
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label" style="width:90px;">申请人姓名</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMHANDLERNAME" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">关系</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMRELATION" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">联系电话</label>
                  <div class="layui-input-inline">
                    <el-input style="width:160px;" v-model="jpmData.JPMHANDLERLINK" readonly></el-input>
                  </div>
                </div>
              </div>

              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label" style="width:90px;">身份证号码</label>
                  <div class="layui-input-inline">
                    <el-input
                      v-model="jpmData.JPMHANDLERCARDNO"
                      @change="(value) => identityNumber(value)"
                      readonly
                    ></el-input>
                  </div>
                </div>
                <div class="layui-inline" style="width:575px;margin-right:0px;">
                  <label class="layui-form-label">联系地址</label>
                  <div class="layui-input-inline">
                    <el-input
                      class="longertext"
                      :autosize="{ minRows: 2, maxRows: 8}"
                      placeholder="请输入详细地址"
                      v-model="jpmData.JPMHANDLERHOUSEHOLD"
                      readonly
                    ></el-input>
                  </div>
                </div>
                <div class="layui-inline-item">
                  <div class="layui-inline" style="width:850px;margin-right:0px;">
                    <label class="layui-form-label" style="width:90px;">备注</label>
                    <div class="layui-input-inline">
                      <el-input
                        class="longertexts"
                        :autosize="{ minRows: 2, maxRows: 8}"
                        placeholder="备注"
                        v-model="jpmData.JPMREMARK"
                        readonly
                      ></el-input>
                    </div>
                  </div>
                </div>
              </div>
            </fieldset>
            <fieldset class="layui-elem-field layui-field-title">
              <legend style="font-weight: bold;">公安注销反馈</legend>
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label">办理日期</label>
                  <div class="layui-input-inline">
                    <!-- JPMCANCELDATE -->
                    <el-input v-model="jpmData.JPMCANCELDATEDESC" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">单位</label>
                  <div class="layui-input-inline">
                    <el-input v-model="jpmData.JPMCANCELUNITDESC" readonly></el-input>
                  </div>
                </div>
                <div class="layui-inline">
                  <label class="layui-form-label">人员</label>
                  <div class="layui-input-inline">
                    <el-input style="width:160px;" v-model="jpmData.JPMCANCELUSR" readonly></el-input>
                  </div>
                </div>
              </div>

              <div class="layui-inline-item">
                <div class="layui-inline" style="width:900px;margin-right:0px;">
                  <label class="layui-form-label">备注</label>
                  <div class="layui-input-inline">
                    <el-input
                      class="longertexts"
                      :autosize="{ minRows: 2, maxRows: 8}"
                      placeholder="备注"
                      v-model="jpmData.JPMCANCELREMARK"
                      readonly
                    ></el-input>
                  </div>
                </div>
              </div>
            </fieldset>
          </div>
          <div class="layui-form-item btnCenter">
            <el-button @click="closeDialog">取消</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane label="联办结果" name="second">
          <el-table :data="tableData" height="500" border style="width: 100%">
            <el-table-column prop="JPBDATETIMEDESC" label="办结时间" width="180"></el-table-column>
            <el-table-column prop="JPBDESC" label="办结结果" width="180"></el-table-column>
            <el-table-column prop="JPBISNEEDLBDESC" label="办结状态"></el-table-column>
            <el-table-column prop="JPBPVDNAME" label="办结单位"></el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="附件信息" name="third">
          <!-- 附件信息 -->
          <fieldset class="layui-elem-field fieldstyle">
            <legend>
              <icon-svg icon-class="jbifm" />&nbsp;附件信息
            </legend>
            <div class="filestyle">
              <!-- v-viewer="{movable: true}" -->
              <ul v-viewer="{movable: true}" style="float:left;">
                <li v-for="(item,index) in filedata" :key="index" v-if="item.FLIENT != '.pdf'">
                  <!-- 附件图片 -->
                  <img :src="item.URLADDRESS" width="200" alt />
                  <!-- 附件名 -->
                  <el-tooltip class="item" effect="dark" :content="item.FLINAMEDESC" placement="bottom">
                    <span class="imgname">{{item.FLINAMEDESC}}</span>
                  </el-tooltip>
                  <!-- 下载按钮 -->
                  <div class="download" @click="download(item)">
                    <!-- <i class="el-icon-download"></i> -->
                    <icon-svg icon-class="download"></icon-svg>
                  </div>
                </li>
              </ul>
              <ul>
                <li v-for="(item,index) in filedata" :key="index" v-if="item.FLIENT == '.pdf'" @click="watchPdf(item)">
                  <!-- 附件图片 -->
                  <img :src="item.showsrc" width="200" alt />
                  <!-- 附件名 -->
                  <el-tooltip class="item" effect="dark" :content="item.FLINAMEDESC" placement="bottom">
                    <span class="imgname">{{item.FLINAMEDESC}}</span>
                  </el-tooltip>
                  <!-- 下载按钮 -->
                  <div class="download" @click="download(item)">
                    <!-- <i class="el-icon-download"></i> -->
                    <icon-svg icon-class="download"></icon-svg>
                  </div>
                </li>
              </ul>
            </div>
          </fieldset>
        </el-tab-pane>
      </el-tabs>
    </sweet-modal>
  </div>
</template>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/common.scss";
.el-button + .el-button {
  margin-left: 0;
}

.longtext {
  width: 480px;
}

.longertext {
  width: 465px;
}
.longertexts {
  width: 770px;
}

.sweet-btn {
  margin-top: 20px;
}

.layui-form-label[data-v-7e4f8d8c] {
  width: 82px;
}

.layui-form-labels[data-v-7e4f8d8c] {
  width: 100px;
  margin: 0;
}

.filestyle {
  border: 1px solid rgba(204, 204, 204, 1);
  height: 300px;

//   .fileorphoto {
//     width: 115px;
//     height: 220px;
//     margin-bottom: 20px;
//     display: inline-block;
//     float: left;

//     .iconsvg {
//       width: 100px;
//       height: 100px;
//       font-size: 100px;
//       display: flex;
//       cursor: pointer;
//     }
//   }
  ul {
    margin-top: 10px;
    overflow-x: auto;
    white-space: nowrap;
    li {
      // float: left;
      display: inline-block;
      margin-left: 10px;
      width: 200px;
      height: 240px;
      border-radius: 10px;
      position: relative;
      overflow: hidden;

      img {
        height: 220px;
        border-radius: 10px;
      }
      .imgname {
        height: 20px;
        line-height: 20px;
        width: 200px;
        text-align: center;
        display: table-cell;
        font-size: 16px;
      }
      .download {
        position: absolute;
        right: 10px;
        bottom: 20px;
        font-size: 20px;
        cursor: pointer;
      }
    }
  }
}
</style>

<script>
import { ORDER } from "@/const/orderConst.js";
import apiBase from "@/api/apiBase.js";
import {
  formatDate,
  timeStringToDate,
  dateStringToDate
} from "@/utils/date.js";
import sweetModal from "@/components/sweetModal";
import Appendixlist from "./Appendixlist";
import checkoutAdd from "../businessHall/checkoutAdd";
import openidentitycard from "@/utils/openIdentityCard.js";
import { identitydata } from "@/utils/openIdentityCard.js";
import { codeValid } from "@/utils/IdentityCodeValid.js";
import { getLodop } from "@/lodop/LodopFuncs.js";
import { MessageBox, Message } from "element-ui";

export default {
  name: "cresimplereg",
  data() {
    return {
      carTimes:[], //瑞安预约时间段接收数组
      carTimenex:{},
      TSPID:null,
      showtimeduan:false,
      showmodel:null, //瑞安个性化控制预约时间显隐
      isshow: false,
      activeName: "first", //tab栏的绑定值
      tableData: [], //联办结果绑定的表格数据
      filedata: [], //附件信息
      addressOptions: [], //待办地址选择
      arr: [], //待办地址id
      pageWidth: 1100,
      maxHeight: 570,
      // isshowbmmc:false,
      title: null,
      isgai: true,
      isshowbeizhu: true,
      szlx: [],
      xblx: [],
      sfzjlx: [],
      cause: [],
      jpmData: {
        ids: null,
        JPMREPORTUNIT: null,
        JPMTYPE: null,
        JPMNAME: null,
        JPMSEX: null,
        JPMTYPES: null,
        JPMSEXS: null,
        JPMAGE: null,
        JPMCARDTYPE: null,
        JPMCARDNO: "",
        JPMDETAILADDRESS: null,
        JPMCAUSEOTHER: null,
        JPMDEATHADDRESS: null,
        JPMDEATHDATE: null,
        JPMBIRTHDATE: null,
        JPMLINKMAN: null,
        JPMLINKLERCARDTYPE: null,
        JPMLINKLERCARDNO: "",
        JPMLINKRELATION: null,
        JPMLINKPHONE: null,
        JPMLINKLERHOUSEHOLD: null,
        JPMADUITREMARK: null,
        JPMCANCELREMARK: null,
        JPMLOWTYPE: null,
        JPMSOCIALYEAR: null,
        JPMCAUSA: [],
        JPMISDEFORMITY: "A",
        JPMISSOCIAL: "A",
        JPMCANCELDATE: null,
        JPMCANCELUNIT: null,
        JPMCANCELUSR: null,
        TSKDATEDESC: null,
        // 所属殡仪馆
        JPMPVDNO: localStorage.getItem("orginCode")
      },
      IsHaveAcceptancePlatform: false,
      datatime: {
        JPMDEATHDATE: null,
        JPMBIRTHDATE: null
      },
      CremationData: {},
      isshowshxg: null,
      // 所属殡仪馆列表
      OrganOptions: []
    };
  },
  methods: {
    handleClick() {},
    GetIsHaveAcceptancePlatform() {
      apiBase.DoService(
        {},
        apiBase.getApiAdress().Param.GetIsHaveAcceptancePlatform,
        res => {
          this.IsHaveAcceptancePlatform = res.data.content;
        }
      );
    },
    // 文件下载
    download(value) {
      // alert("文件下载啦！！！");
      // return;
      this.downloadFile(value.FLINAMEDESC, value.FLIOSSKEY + ',' + value.FLECONTEXT, value.FLIENT); //文件名、base64、文件后缀名
    },
    downloadFile(fileName, content, filent) {
      const blob = this.base64ToBlob(content); // new Blob([content]);
      if (window.navigator.msSaveOrOpenBlob) {
        navigator.msSaveBlob(blob, fileName + "." + filent);
      } else {
        const link = document.createElement("a");
        link.href = window.URL.createObjectURL(blob);
        link.download = fileName + "." + filent;

        //此写法兼容可火狐浏览器
        document.body.appendChild(link);
        const evt = document.createEvent("MouseEvents");
        evt.initEvent("click", false, false);
        link.dispatchEvent(evt);
        document.body.removeChild(link);
      }
    },
    base64ToBlob(code) {
      const parts = code.split(";base64,");
      const contentType = parts[0].split(":")[1];
      const raw = window.atob(parts[1]);
      const rawLength = raw.length;
      const uInt8Array = new Uint8Array(rawLength);
      for (let i = 0; i < rawLength; ++i) {
        uInt8Array[i] = raw.charCodeAt(i);
      }
      // 'application/x-zip-compressed'  rar的改成这个格式
      return new Blob([uInt8Array], { type: contentType });
    },
    //pdf文件预览
    watchPdf(item){
      if(item.URLADDRESS){
        window.open(item.URLADDRESS);
      }
    },
    // 获取所属殡仪馆
    getOrgan() {
      apiBase.DoService(
        {},
        apiBase.getApiAdress().JointRegistration.QueryOrgan,
        res => {
          let options = res.data.content;
          this.jpmData.JPMPVDNO = options[0].ORGID;
          this.OrganOptions = options.map(item => {
            if (localStorage.getItem("orginCode") === item.ORGDTRCODE) {
              this.jpmData.JPMPVDNO = item.ORGID;
            }
            return (item = {
              label: item.ORGNAME,
              value: item.ORGID,
              code: item.ORGDTRCODE
            });
          });
        }
      );
    },
    //是否显示待办地址
    Ifshow() {
      apiBase.DoService(
        {},
        apiBase.getApiAdress().Param.GetIsAddJointDisplayAddress,
        res => {
          this.isshow = res.data.content;
        }
      );
    },
    GetIsShowTspCarForLBDD(){
      apiBase.DoService(
        {},
        apiBase.getApiAdress().Param.GetIsShowTspCarForLBDD,
        res => {
          this.showmodel = res.data.content;
        }
      );
    },
    //获取详情
    getLianbanDetail(id) {
      let data = {
        JPMID: id
      };
      apiBase.DoService(
        data,
        apiBase.getApiAdress().JointRegistration.DetailAll,
        res => {
          let datalist= res.data.content;
          this.jpmData = res.data.content;
          if(datalist.TSKDATE){
            this.jpmData.TSKDATE=datalist.TSKDATEDESC
            this.showtimeduan=true;
            if(datalist.TSPID){
            this.TSPID=datalist.TSPID;
            this.carTimenex.TSKHASCOUNT=datalist.TSKHASCOUNT;
            this.carTimenex.TSPNUBER=datalist.TSPNUBER;
            }else{}
          }else{
            this.showtimeduan=false;
          }
          this.tableData = res.data.content.Jpbs;
          this.filedata = res.data.content.Flis;
         
          this.filedata.forEach(item => {
            item.FLIENT.toLocaleLowerCase();
            if(item.FLIENT == '.pdf'){
              item.showsrc = '../../../static/imgs/pdf.png';
            }
          });
          
          if (this.isshow == true) {
            this.arr = res.data.content.JPMSARID.split(",");
          }
          this.jpmData.JPMREPORTUNIT = res.data.content.JPMREPORTUNIT;
          this.jpmData.JPMREPORTUNITDESC = res.data.content.JPMREPORTUNITDESC;
          this.jpmData.DECNO = res.data.content.DECNO; //预约编号
          this.jpmData.JPMCAUSAS =
            res.data.content.JPMCAUSADESC +
            "/" +
            res.data.content.JPMCAUSASONDESC;
          this.jpmData.JPMDEATHDATE = res.data.content.JPMDEATHDATEDESC; //死亡日期   JPMDEATHDATEDESC
          // JPMDEATHDATEDESC
          this.datatime.JPMDEATHDATE = res.data.content.JPMDEATHDATEDESC; //死亡日期  JPMDEATHDATEDESC

          this.jpmData.JPMBIRTHDATE = res.data.content.JPMBIRTHDATEDESC; //出生日期
          this.datatime.JPMBIRTHDATE = res.data.content.JPMBIRTHDATEDESC; //出生日期
          this.jpmData.JPMSEX = res.data.content.JPMSEX;
          this.jpmData.JPMSEXS = res.data.content.JPMSEXDESC;
          this.jpmData.JPMCAUSA = [
            res.data.content.JPMCAUSA,
            res.data.content.JPMCAUSASON
          ];
          this.jpmData.JPMTYPES = res.data.content.JPMTYPEDESC;
          this.jpmData.JPMADUITREMARK = res.data.content.JPMADUITREMARK;
          if (this.title === "冻结") {
            this.jpmData.JPMTYPE = "C";
          }
          if (this.title === "户口注销") {
            this.jpmData.JPMCANCELUSR = localStorage.getItem("username");
          }
        }
      );
    },
    restructur(value) {
      let arr = JSON.parse(JSON.stringify(value));
      var data = [];
      arr.forEach(item => {
        if (item.Children.length > 0) {
          data.push({
            label: item.SARNAME,
            value: item.SARID,
            children: this.restructur(item.Children)
          });
        } else {
          data.push({
            label: item.SARNAME,
            value: item.SARID
          });
        }
      });
      return data;
    },
    init(){
      // 获取级联选择
      apiBase.DoService({}, apiBase.getApiAdress().Code.GetBorough, res => {
        let data = res.data.content;
        this.addressOptions = data.map(item => ({
          label: item.SARNAME,
          value: item.SARID,
          children: item.Children.map(item => ({
            label: item.SARNAME,
            value: item.SARID,
            children: this.restructur(item.Children)
          }))
        }));
      });
    },
    //打开页面
    open(order, id, ids) {
      this.isshowbeizhu = true;
      this.order = order;
      this.ids = id;
      this.maxHeight = window.innerHeight - 240;
      //清理数据
      this.dataRepeat();
      switch (this.order) {
        case "详情": //登记详情
          this.title = "联办详情";
          this.getLianbanDetail(id);
          this.$refs.dialogdetail.open();
          break;
      }
    },
    //取消按钮
    closeDialog() {
      if (this.order === "详情") this.$refs.dialogdetail.close();
    },
    //数据重置
    dataRepeat() {
      Object.assign(this.$data.jpmData, this.$options.data().jpmData);
      this.datatime.JPMBIRTHDATE = null;
      this.datatime.JPMDEATHDATE = null;
      this.jpmData.DECNO = null;
      this.arr = [];
    }
  },
  components: {
    sweetModal,
    checkoutAdd,
    Appendixlist
  },
  mounted() {},
  created() {
    this.GetIsHaveAcceptancePlatform();
    this.getOrgan();
    this.Ifshow();
    this.init();
    this.GetIsShowTspCarForLBDD();
  },

  watch: {}
};
</script>
